package com.xyp.sso.testrun;

import java.util.concurrent.CountDownLatch;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class) // 使用junit4进行测试
@ContextConfiguration(locations = { "classpath:spring-context-provider.xml" }) // 加载配置文件
public class JunitProviduct {

    private static CountDownLatch downLatch = new CountDownLatch(1);

    @Test
    public void runTest() {

        try {
            downLatch.await();
        }
        catch (InterruptedException e) {
            e.printStackTrace();
        }

    }

    public static void main(String[] args) {

        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
                "spring-context-provider.xml");

        applicationContext.start();
        System.out.println("123");
        try {
            downLatch.await();
        }
        catch (InterruptedException e) {
            e.printStackTrace();
        }

    }

}
